This is not a good pattern to access query parameters in a view. The view should use the model provided by the controller. So the controller reads query parameters and passes them to the view.
For accessing query string to the controller to view then you can set that value to a property in your ViewBag. The ViewBag property can then be read in from your view.You can access Request variable in your view.
In Controller:
ViewBag.Val = Request.QueryString["Value"];
In View:
@if(ViewBag.Val == "......"){ ... }
Liked By
Write Answer
how to access query string value in ASP.Net MVC View
Join MindStick Community
You have need login or register for voting of answers or question.
Anupam Mishra
14-Mar-2016